update() {
let iconSize = this._getIconSize();
- let iconFile = this._user.get_icon_file();
- if (iconFile && !GLib.file_test(iconFile, GLib.FileTest.EXISTS))
- iconFile = null;
+ let iconFile = null;
+ if (this._user) {
+ iconFile = this._user.get_icon_file();
+ if (iconFile && !GLib.file_test(iconFile, GLib.FileTest.EXISTS))
+ iconFile = null;
+ }
if (iconFile) {
this.child = null;
var UserWidget = GObject.registerClass(
class UserWidget extends St.BoxLayout {
_init(user, orientation = Clutter.Orientation.HORIZONTAL) {
+ // If user is null, that implies a username-based login authorization.
this._user = user;
let vertical = orientation == Clutter.Orientation.VERTICAL;
this._avatar.x_align = Clutter.ActorAlign.CENTER;
this.add_child(this._avatar);
- this._label = new UserWidgetLabel(user);
- this.add_child(this._label);
+ this._userLoadedId = 0;
+ this._userChangedId = 0;
+ if (user) {
+ this._label = new UserWidgetLabel(user);
+ this.add_child(this._label);
- this._label.bind_property('label-actor', this, 'label-actor',
- GObject.BindingFlags.SYNC_CREATE);
+ this._label.bind_property('label-actor', this, 'label-actor',
+ GObject.BindingFlags.SYNC_CREATE);
+
+ this._userLoadedId = this._user.connect('notify::is-loaded', this._updateUser.bind(this));
+ this._userChangedId = this._user.connect('changed', this._updateUser.bind(this));
+ }
- this._userLoadedId = this._user.connect('notify::is-loaded', this._updateUser.bind(this));
- this._userChangedId = this._user.connect('changed', this._updateUser.bind(this));
this._updateUser();
}